package threads;

public class SampleThread extends Thread {

	public SampleThread(String name) {
		super(name);
	}

	public void run() {
		for (int i = 1; i <= 10; i++) {
			System.out.printf("%s : step %d\n", getName(), i);
			try {
				sleep((long) (Math.random() * 1000));
			} catch (InterruptedException e) { }
		}
		System.out.printf("%s : DONE.\n", getName());
	}

	public static void main(String[] args) {
		SampleThread t1 = new SampleThread("Thread #1");
		t1.start();
		SampleThread t2 = new SampleThread("Thread #2");
		t2.start();
		SampleThread t3 = new SampleThread("Thread #3");
		t3.start();
	}

}
